Class Walktrap
java.lang.Object
edu.claflin.finder.algo.Algorithm
edu.claflin.finder.algo.clustering.ClusteringAlgorithm
edu.claflin.finder.algo.clustering.Walktrap
- All Implemented Interfaces:
Processable<Graph,Graph>
Walktrap Algorithm for Community Detection. Random walks from a Node in
a community tend to stay in the same Node. Based on python's igraph library.
- Author:
- Cesar Martin and Adolfo Perera
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classStores the delta sigmas between a Community C connected to community 1 or community 2.Nested classes/interfaces inherited from class edu.claflin.finder.algo.Algorithm
Algorithm.GraphSortOrder -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intFields inherited from class edu.claflin.finder.algo.Algorithm
args, PROP_PROGRESS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet a probability vector for a community.private doubledelta_sigma(int C1index, int C2index, List<Node> nList, Communities cms) Calculate delta sigma from communities C1 and C2 according to Section 4.2 Theorem 5 in the paper.private doubleCompute the distance between community i and community j.private intGet the Node degree.private doubleGet the Node weight.merge_probs(int i, int j, Communities cms) Calculate the probability vectors of joining 2 communities.Processes data.private voidremove_node(HeapNodeWT info, PriorityQueue<HeapNodeWT> q) Remove a HeapNode from the Queue.toString()Methods inherited from class edu.claflin.finder.algo.clustering.ClusteringAlgorithm
buildCommunityGraphs, isWeightedMethods inherited from class edu.claflin.finder.algo.Algorithm
addPropertyChangeListener, cull, getGraphSortOrder, getMinNodeCount, getPartiteNumber, getWeightName, removePropertyChangeListener, setGraphSortOrder, setMinNodeCount, setPartiteNumber, setProgress, setWeightName, zeropad
-
Field Details
-
steps
private int steps -
Pv
-
-
Constructor Details
-
Walktrap
-
-
Method Details
-
toString
-
process
Description copied from interface:ProcessableProcesses data.- Parameters:
graph- the T type object to process.- Returns:
- the S type object array produced by the processing.
-
remove_node
Remove a HeapNode from the Queue.- Parameters:
info- the node to removeq- the priority queue to remove from
-
delta_sigma
Calculate delta sigma from communities C1 and C2 according to Section 4.2 Theorem 5 in the paper.- Parameters:
C1index- the index of community C1 in the listC2index- the index of community C2 in the listnList- the sorted Node listcms- the Communities- Returns:
- the delta sigma between C1 and C2
-
getDegree
Get the Node degree. The algorithm counts the node itself as a degree.- Parameters:
n- the Node to get the degree of- Returns:
- the degree of the Node counting itself
-
getWeight
Get the Node weight. The algorithm counts the node itself as having a weight of weight/degree.- Parameters:
n- the Node to get the weight of- Returns:
- the weight of the Node counting its own
-
cprobs
Get a probability vector for a community. The probabilities are of going from the community to all Nodes in a random walk of length steps instance variable. This is an adaptation of the int constructor of the Probabilities class in igraph master's walktrap_communities.cpp- Parameters:
C- the communitygraph- the original graphnList- the sorted list of Nodes- Returns:
- the probability vector
-
merge_probs
Calculate the probability vectors of joining 2 communities. Equation in section 4.4 of the paper (first bullet point). This is an adaptation of the 2 ints constructor of the Probabilities class in igraph master's walktrap_communities.cpp- Parameters:
i- index of community 1j- index of community 2cms- the Communities- Returns:
- the new probability vector
-
distance
Compute the distance between community i and community j. This is an adaptation of the 2 ints constructor of the compute_distance of the Probabilities class in igraph master's walktrap_communities.cpp- Parameters:
i- index of community 1j- index of community 2nList- the sorted list of nodes- Returns:
- the distance between the communities
-